#ifndef __WINDOW__HPP__
#define __WINDOW__HPP__
#include "matrix.cpp"
#include "model.hpp"
#include "modelTextured.hpp"
#include "arcball.hpp"
#include "tgaimage.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

//static model *m;
static modelTextured *mt;
static arcball *a;
static unsigned int width, height;
static int win,fps;
static bool mouseLeft,mouseRight,mouseMiddle;
static bool redraw,normaldir;

static GLuint tex_name;
static unsigned char *texture_buffer = NULL;
static TGAImage tgaimage;
static TGAImage screen;
static float *zbuffer = NULL;

static int texture_width  = 800;
static int texture_height = 800;
static int texture_depth = 800;
static vector<double> light0(5.0,5.0,1.0);

void bind_texture();
void recalc_texture();

void init();
void destroy();

void launch(int argc, char *argv[]);

void draw();
void wait();
void keyboard(unsigned char touche, int x, int y);
void mouse(int button, int state, int x, int y);
void motion(int x, int y);

void drawModelPoint(model *m);
void drawModelLine(model *m);
void drawModelLineNormal(model *m);
void drawModelFaceNormal(model *m);

void drawModelPoint(modelTextured *m);
void drawModelLine(modelTextured *m);
void drawModelLineNormal(modelTextured *m);
void drawModelFaceNormal(modelTextured *m);

void drawFace(vector<int> p1,vector<int> p2,vector<int> p3);
void drawLine(int x1,int y1,int x2,int y2);
void drawHLine(int x1,int x2,int y);
#endif
